/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.agilelang.generate;



/**
 *
 * @author Roderick
 */
public class Partial {

    String file = "";
    String file_aux = "";

    public Partial(String path) {
        file = UtilFile.readFile(path);
        file_aux = file;
    }

    public void setBlank() {
        file_aux = file;
    }

    public void replace(String key, String value) {
        file_aux = file_aux.replace(key, value);
    }

    public void replace_name(String name) {
        file_aux = file_aux.replace("//names//", Inflector.getInstance().pluralize(name).toLowerCase());
        file_aux = file_aux.replace("//NAMES//", Inflector.getInstance().pluralize(name).toUpperCase());
        file_aux = file_aux.replace("//Names//", Inflector.getInstance().capitalize(Inflector.getInstance().pluralize(name)));
        file_aux = file_aux.replace("//name//", Inflector.getInstance().singularize(name).toLowerCase());
        file_aux = file_aux.replace("//NAME//", Inflector.getInstance().singularize(name).toUpperCase());
        file_aux = file_aux.replace("//Name//", Inflector.getInstance().capitalize(Inflector.getInstance().singularize(name)));
    }

    public String getPtl() {
        return file_aux;
    }
}
